<?php

namespace App\Transformers;

use App\Models\UserData;

class UserDataTransformer extends BaseTransformer
{
    protected $defaultIncludes = ['pictures'];

    public function transform(UserData $model)
    {
        return [
            'id' => $model->id,
            'user_id' => $model->user_id,                               #用户id
            'age' => $model->age,                                       #年龄
            'stature' => $model->stature,                               #身高
            'weight' => $model->weight,                                 #体重
            'bust' => $model->bust,                                     #胸围
            'waist' => $model->waist,                                   #腰围
            'hips' => $model->hips,                                     #臀围
            'intro' => $model->intro,                                   #介绍
            'video_cover' => image_url($model->video_cover),            #视频封面
            'video' => $model->video,                                   #视频地址
        ];
    }

    public function includePictures(UserData $model)
    {
        return $this->collection($model->pictures, new PictureTransformer());
    }
}
